package com.bo.wei.chen.mybatis.controller;

import com.bo.wei.chen.mybatis.model.Student;
import com.bo.wei.chen.mybatis.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author DELL
 */
@RestController
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private StudentService studentService;

    /**
     * 查询全部
     *
     * @return int
     */
    @RequestMapping("/select")
    public List<Student> select() {
        // return studentService.select();
	    return studentService.select();
    }

    /**
     * 增加
     *
     * @param student 条件
     *
     * @return int
     */
    @RequestMapping("/add")
    public int add(Student student) {
        return studentService.add(student);
    }

    /**
     * 修改
     *
     * @param student 条件
     *
     * @return int
     */
    @RequestMapping("/update")
    public int update(Student student) {
        return studentService.update(student);
    }

    /**
     * 删除
     *
     * @param id 条件
     *
     * @return int
     */
    @RequestMapping("/delete")
    public int delete(int id) {
        return studentService.delete(id);
    }
}
